package cn.vendcommon.com.exception;


import cn.vendcommon.com.entity.constants.CommonCodeMsg;
import lombok.Data;

@Data
public class VendException extends RuntimeException {
//    private final Integer code;
//    private final String message;
    private CommonCodeMsg commonCodeMsg;

    // 直接传枚举
    public VendException(CommonCodeMsg errorCode) {
        super(errorCode.getMsg());
        commonCodeMsg = errorCode;
    }

//    // 也支持自定义错误
//    public VendException(Integer code, String message) {
//        super(message);
//        this.code = code;
//        this.message = message;
//    }
}
